
let mode = process.env.NODE_ENV; //当前启动模式

const IS_PROD = ['production', 'prod'].includes(mode); //判断是否是生产模式
const NEED_MOCK = ['development', 'serve'].includes(mode);
const apiMock = require('mocker-api');
const path = require('path');
const resolve = (dir) => {
  return path.join(__dirname, dir);
}
module.exports = {
  devServer: {
    open: !IS_PROD,
    port: 8080,
    // https:true,
    // before(app) {
    //   if (NEED_MOCK) {
    //     apiMock(app, resolve('./mock/index.js'))
    //   }
    // },
    proxy: {
      '/api': {
        target: 'http://localhost:10081',
        changeOrigin: true,
        pathRewrite: {
          '^/api': ''
        },
        ws:false,
        changeOrigin:true,
      }
    }
  },

}